home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / NEW_TECH / HYPERO.ZIP / roidsupp.c < prev    next >
C/C++ Source or Header  |  1994-04-12  |  19KB  |  545 lines

  1. // ***************************************************************************
  2. // ROIDSUPP.C - hyperoid support functions
  3. //
  4. // Version: 1.1  Copyright (C) 1990,91 Hutchins Software
  5. //      This software is licenced under the GNU General Public Licence
  6. //      Please read the associated legal documentation
  7. //
  8. // Author: Edward Hutchins
  9. // Internet: eah1@cec1.wustl.edu
  10. // USMail: c/o Edward Hutchins, 63 Ridgemoor Dr., Clayton, MO, 63105
  11. //
  12. // Revisions:
  13. // 11/01/91 added GNU General Public License - Ed.
  14. //
  15. // Music: R.E.M./The Cure/Ministry/Front 242/The Smiths/New Order/Hendrix...
  16. // Beers: Bass Ale, Augsberger Dark
  17. //
  18. // 03/04/92 ported to Win32 - Paul Tissue & Robert Hess [Microsoft].
  19. // ***************************************************************************
  20. #include "hyperoid.h"
  21.  
  22. //
  23. // defines
  24. //
  25.  
  26. // You may ask, "why did he embed all these string constants instead of
  27. // using the resource file?". Good question.  The answer is: I feel better
  28. // knowing this stuff is part of the executable, and not part of the resource
  29. // file (which can be changed by sneaky people). Or maybe I wuz lazy.
  30. // If you don't like it, then YOU can change it!
  31.  
  32. #define NL "\x0d\x0a"
  33.  
  34. #define HYPEROID_HELP \
  35. "The following keys control your ship:" NL NL \
  36. "  Left, Right Arrow .... spin left or right" NL \
  37. "  Down, Up Arrow ..... forward or reverse thrust" NL \
  38. "  Space Bar .............. fire!" NL \
  39. "  Tab ......................... shields" NL \
  40. "  S ............................. smartbomb" NL \
  41. "  Esc ......................... pause/boss key" NL NL \
  42. "Note: You have 3 lives, unlimited fuel and firepower, 3 shields and 3 " \
  43. "smartbombs. Your ship gets darker when you lose a life, but you keep on " \
  44. "playing (unless you hit an asteroid). You get an extra life every 100,000 " \
  45. "points. When you lose the game, you start over immediately and can finish " \
  46. "off the current level (which should now be 0) before starting over at " \
  47. "level 1 (There is no waiting around between games)."
  48.  
  49. #define HYPEROID_HELP2 \
  50. "The HYPEROID.INI file can be created/modified to change default settings " \
  51. "in Hyperoid. Here are some of the items you can set:" NL \
  52. NL "[Hyperoid]" NL "Max=<0/1>" NL "{X,Y,W,H}=<n>" NL "Mono=<0/1>" NL \
  53. "DrawDelay=<ms> ;microseconds/frame" NL \
  54. NL "[Palette]" NL \
  55. "{Black,DkGrey,Grey,White," NL \
  56. " DkRed,Red,DkGreen,Green,DkBlue,Blue," NL \
  57. " DkYellow,Yellow,DkCyan,Cyan," NL \
  58. " DkMagenta,Magenta}=<r>,<g>,<b>" NL \
  59. NL "[Keys]" NL \
  60. "{Shield,Clockwise,CtrClockwise," NL \
  61. " Thrust,RevThrust,Fire,Bomb}=<virtual keycode>" NL NL \
  62. "Note: Virtual keycodes usually match the key's ASCII value."
  63.  
  64. #define HYPEROID_HELPSTYLE (MB_OK | MB_ICONASTERISK)
  65.  
  66. // this is the part I especially want in the executable image
  67.  
  68. #define HYPEROID_LICENSE \
  69. "This program is free software; you can redistribute it and/or modify " \
  70. "it under the terms of the GNU General Public License as published by " \
  71. "the Free Software Foundation; either version 1, or (at your option) " \
  72. "any later version. " \
  73. NL NL \
  74. "This program is distributed in the hope that it will be useful, " \
  75. "but WITHOUT ANY WARRANTY; without even the implied warranty of " \
  76. "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the " \
  77. "GNU General Public License for more details. " \
  78. NL NL \
  79. "You should have received a copy of the GNU General Public License " \
  80. "along with this program; if not, write to the Free Software " \
  81. "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. "
  82.  
  83. //
  84. // imports
  85. //
  86.  
  87. IMPORT CHAR    szAppName[32] FROM ( hyperoid.c );
  88. IMPORT HANDLE  hAppInst      FROM ( hyperoid.c );
  89. IMPORT HWND    hAppWnd       FROM ( hyperoid.c );
  90. IMPORT BOOL    bBW           FROM ( hyperoid.c );
  91. IMPORT INT     nDrawDelay    FROM ( hyperoid.c );
  92. IMPORT INT     vkShld        FROM ( hyperoid.c );
  93. IMPORT INT     vkClkw        FROM ( hyperoid.c );
  94. IMPORT INT     vkCtrClkw     FROM ( hyperoid.c );
  95. IMPORT INT     vkThrst       FROM ( hyperoid.c );
  96. IMPORT INT     vkRvThrst     FROM ( hyperoid.c );
  97. IMPORT INT     vkFire        FROM ( hyperoid.c );
  98. IMPORT INT     vkBomb        FROM ( hyperoid.c );
  99. IMPORT LONG    lHighScore    FROM ( hyperoid.c );
  100.  
  101. //
  102. // globals
  103. //
  104.  
  105. // these parts map to "abcdefghijklm"
  106. GLOBAL POINT        LetterPart[] =
  107. {
  108.   {83, 572}, {64, 512}, {45, 572}, {96, 362}, {32, 362},
  109.   {128, 256}, {0, 0}, {0, 256},
  110.   {160, 362}, {224, 362}, {173, 572}, {192, 512}, {211, 572}
  111. };
  112.  
  113. // here's the vector font
  114. GLOBAL LPSTR        szNumberDesc[] =
  115. {
  116.         "cakmck",       // 0
  117.         "dbl",          // 1
  118.         "abekm",        // 2
  119.         "abegjlk",      // 3
  120.         "mcfh",         // 4
  121.         "cbfgjlk",      // 5
  122.         "bdiljgi",      // 6
  123.         "acgl",         // 7
  124.         "bdjlieb",      // 8
  125.         "ljebdge"       // 9
  126. };
  127.  
  128. GLOBAL LPSTR        szLetterDesc[] =
  129. {
  130.         "kdbemhf",      // A
  131.         "kabegjlk",     // B
  132.         "cbflm",        // C
  133.         "kabejlk",      // D
  134.         "cafgfkm",      // E
  135.         "cafgfk",       // F
  136.         "bdiljhg",      // G
  137.         "kafhcm",       // H
  138.         "bl",           // I
  139.         "cjli",         // J
  140.         "akcgm",        // K
  141.         "akm",          // L
  142.         "kagcm",        // M
  143.         "kamc",         // N
  144.         "bdiljeb",      // O
  145.         "kabegf",       // P
  146.         "mlidbejl",     // Q
  147.         "kabegfgm",     // R
  148.         "ebdjli",       // S
  149.         "lbac",         // T
  150.         "ailjc",        // U
  151.         "alc",          // V
  152.         "akgmc",        // W
  153.         "amgkc",        // X
  154.         "aglgc",        // Y
  155.         "ackm"          // Z
  156. };
  157.  
  158. //
  159. // locals
  160. //
  161.  
  162. LOCAL CHAR  szIni[]          = "HYPEROID.INI";
  163. LOCAL CHAR  szLicense[]      = "LicenseRead";
  164. LOCAL CHAR  szDrawDelay[]    = "DrawDelay";
  165. LOCAL CHAR  szMax[]          = "Max";
  166. LOCAL CHAR  szX[]            = "X";
  167. LOCAL CHAR  szY[]            = "Y";
  168. LOCAL CHAR  szW[]            = "W";
  169. LOCAL CHAR  szH[]            = "H";
  170. LOCAL CHAR  szBW[]           = "Mono";
  171. LOCAL CHAR  szPalette[]      = "Palette";
  172. LOCAL CHAR  szKeys[]         = "Keys";
  173. LOCAL CHAR  szShield[]       = "Shield";
  174. LOCAL CHAR  szClockwise[]    = "Clockwise";
  175. LOCAL CHAR  szCtrClockwise[] = "CtrClockwise";
  176. LOCAL CHAR  szThrust[]       = "Thrust";
  177. LOCAL CHAR  szRevThrust[]    = "RevThrust";
  178. LOCAL CHAR  szFire[]         = "Fire";
  179. LOCAL CHAR  szBomb[]         = "Bomb";
  180. LOCAL CHAR  szHi[]           = "Hi";
  181.  
  182. LOCAL CHAR  *szColorName[] =
  183. {
  184.         "Black", "DkGrey", "Grey", "White",
  185.         "DkRed", "Red",  "DkGreen", "Green", "DkBlue", "Blue",
  186.         "DkYellow", "Yellow", "DkCyan", "Cyan", "DkMagenta", "Magenta"
  187. };
  188.  
  189. LOCAL DWORD         dwColors[] =
  190. {
  191.   RGB(0,0,0), RGB(128,128,128),
  192.   RGB(192,192,192), RGB(255,255,255),
  193.   RGB(128,0,0), RGB(255,0,0),
  194.   RGB(0,128,0), RGB(0,255,0),
  195.   RGB(0,0,128), RGB(0,0,255),
  196.   RGB(128,128,0), RGB(255,255,0),
  197.   RGB(0,128,128), RGB(0,255,255),
  198.   RGB(128,0,128), RGB(255,0,255),
  199. };
  200.  
  201.  
  202. // ***************************************************************************
  203. // PrintLetters - create letter objects from a string
  204. // ***************************************************************************
  205. VOID APIENTRY
  206. PrintLetters( LPSTR lpszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize )
  207. {
  208.         INT             nLen = strlen( lpszText );
  209.         INT             nCnt = nLen;
  210.         INT             nSpace = nSize + nSize / 2;
  211.         INT             nBase = (nLen - 1) * nSpace;
  212.         INT             nBaseStart = Pos.x + nBase / 2;
  213.  
  214.         while (nCnt--)
  215.         {
  216.                 NPOBJ npLtr = CreateLetter( lpszText[nCnt],
  217.                                             nSize / 2, 20 + arand(70));
  218.                 if (npLtr)
  219.                 {
  220.                         npLtr->Pos.x = nBaseStart;
  221.                         npLtr->Pos.y = Pos.y;
  222.                         npLtr->Vel = Vel;
  223.                         npLtr->byColor = byColor;
  224.                 }
  225.                 nBaseStart -= nSpace;
  226.         }
  227. }
  228.  
  229.  
  230. // ***************************************************************************
  231. /